package cn.iocoder.yudao.module.ao.dal.mysql.teacher;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ao.dal.dataobject.teacher.TeacherDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ao.controller.admin.teacher.vo.*;

/**
 * 教师信息 Mapper
 *
 * @author 禾安
 */
@Mapper
public interface TeacherMapper extends BaseMapperX<TeacherDO> {

    default PageResult<TeacherDO> selectPage(TeacherPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TeacherDO>()
                .eqIfPresent(TeacherDO::getDeptName, reqVO.getDeptName())
                .likeIfPresent(TeacherDO::getTeacherName, reqVO.getTeacherName())
                .likeIfPresent(TeacherDO::getTeacherNo, reqVO.getTeacherNo())
                .likeIfPresent(TeacherDO::getPosition, reqVO.getPosition())
                .eqIfPresent(TeacherDO::getGender, reqVO.getGender())
                .eqIfPresent(TeacherDO::getMaritalStatus, reqVO.getMaritalStatus())
                .likeIfPresent(TeacherDO::getEducationLevel, reqVO.getEducationLevel())
                .likeIfPresent(TeacherDO::getMajor, reqVO.getMajor())
                .likeIfPresent(TeacherDO::getGraduateSchool, reqVO.getGraduateSchool())
                .betweenIfPresent(TeacherDO::getEntryDate, reqVO.getEntryDate())
                .likeIfPresent(TeacherDO::getProfessionalTitle, reqVO.getProfessionalTitle())
                .betweenIfPresent(TeacherDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(TeacherDO::getTeacherId));
    }

}